package com.kuangstudy.test;

import java.util.Arrays;

/**
 * @author Losca
 * @date 2022/3/22 13:04
 */
public class Demo3 {
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5};
        int[] reverse = reverse(arr);
        System.out.println(Arrays.toString(arr));
    }
    public static int[] reverse(int[] arr){
        int[] result = new int[arr.length];
        for (int i = 0,j = arr.length -1; i < arr.length; i++,j--) {
            result[j] = arr[i];
        }
        return result;
    }

    public  void print(int[] arr){
        for (int i : arr) {
            System.out.print(i);
        }
    }
}
